package com.rzjm.exercise.common.utils;

public abstract class ConvertUtils {
    @SuppressWarnings("unchecked")
	public static <T> T convert(final Object value, final Class<T> targetType, final T defaultValue) {
    	T result = (T) org.apache.commons.beanutils.ConvertUtils.convert(value, targetType);
    	
        return result != null ? result : defaultValue;
    }
    
	public static <T> T convert(final Object value, final Class<T> targetType) {
        return convert(value, targetType, null);
    }
}
